<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>超市账单管理系统</title>
    <link rel="stylesheet" href="../css/public.css"/>
    <link rel="stylesheet" href="../css/style.css"/>
    <link rel="stylesheet" href="../layui/layui/css/layui.css"  media="all">
</head>
<body>
<!--头部-->
<div id="first"></div>
<!--主体内容-->
<section class="publicMian ">
    <div id="left"></div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>用户管理页面 >> 用户添加页面</span>
        </div>
        <div class="providerAdd">
            <form id="userform" action="/smbms/user/doadduser2" method="POST" enctype="multipart/form-data">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div class="">
                    <label for="userId">用户编码：</label>
                    <input type="text" name="userCode" id="userId"/>
                    <span>*请输入用户编码，且不能重复</span>
                </div>
                <div>
                    <label for="userName">用户名称：</label>
                    <input type="text" name="userName" id="userName"/>
                    <span >*请输入用户名称</span>
                </div>
                <div>
                    <label for="userPassword">用户密码：</label>
                    <input type="text" name="userPassword" id="userpassword"/>
                    <span>*密码长度必须大于6位小于20位</span>

                </div>
                <div>
                    <label for="userRemi">确认密码：</label>
                    <input type="text" name="userRemi" id="userRemi"/>
                    <span>*请输入确认密码</span>
                </div>
                <div>
                    <label >用户性别：</label>

                    <select name="gender">
                        <option value="1">男</option>
                        <option value="2">女</option>
                    </select>
                    <span></span>
                </div>
                <div>
                    <label for="data">出生日期：</label>
                    <input type="date" name="birthday" id="data"/>
                    <span >*</span>
                </div>
                <div>
                    <label for="userphone">用户电话：</label>
                    <input type="text" name="phone" id="userphone"/>
                    <span >*</span>
                </div>
                <div>
                    <label for="userAddress">用户地址：</label>
                    <input type="text" name="address" id="userAddress"/>
                </div>
                <div>
                    <label >用户类别：</label>
                    <input type="radio" name="userRole" value="1"/>管理员
                    <input type="radio" name="userRole" value="2"/>经理
                    <input type="radio" name="userRole" value="3"/>普通用户
                </div>

                <div>
                    <label >用户个人照片</label>
                    <input type="file" name="attachs"/>
                </div>

                <div>
                    <label >用户工作照片</label>
                    <input type="file" name="attachs"/>
                </div>


                <div class="providerAddBtn">
                    <!--<a href="#">保存</a>-->
                    <!--<a href="userList.html">返回</a>-->
                    <input type="button"  id="save" value="保存"/>
                    <input type="button" value="返回" onclick="history.back(-1)"/>
                </div>
            </form>
        </div>
    </div>
</section>
<div id="last"></div>
<script src="../js/jquery.js"></script>
<script src="../js/js.js"></script>
<!--<script src="../js/time.js"></script>-->
<script src="../js/common.js"></script>
<script src="../layui/layui/layui.js"></script>
<script src="../js/jquery-form.js"></script>
</body>
</html>
<script>
    var flag=true;
    $(function() {
        $("#first").load("../common/header.html");
        $("#last").load("../common/footer.html");
        $("#left").load("../common/left.html");

        $("#save").click(function(){
            //获取form
            var $form=$("#userform");
            //选项
            var option={
                dataType:"json",
                success:function(data){
                    alert("添加成功")
                  location.href="userList.html";
                }
            };
            //发送请求  代码控制提交
            $form.ajaxSubmit(option);
        });

    })
</script>